package com.alks.common.utils;

import com.alks.common.data.thread.UserIdThread;
import org.apache.commons.lang3.RandomStringUtils;

/**
 * 获取用户工具类
 */
public class UserInfoUtil {

    public static UserInfo getUserInfo() {
        String companyId = UserIdThread.get().getCompanyId();
        String userName = UserIdThread.get().getUserName();
        String loginName = UserIdThread.get().getLoginName();
        return new UserInfo(companyId, userName, loginName);
    }

    public static class UserInfo {
        private String companyId;
        private String userName;
        private String loginName;

        public UserInfo(String companyId, String userName,String loginName) {
            this.companyId = companyId;
            this.userName = userName;
            this.loginName = loginName;
        }

        public String getCompanyId() {
            return companyId;
        }

        public String getUserName() {
            return userName;
        }

        public String getLoginName() {
            return loginName;
        }

        public void setCompanyId(String companyId) {
            this.companyId = companyId;
        }

    }

    public static void main(String[] args) {
        String soft = RandomStringUtils.random(6,true,true);
        String s = MD5Utils.md5("123" + soft);
        System.out.println(s);
        System.out.println(soft);
    }
}
